package com.tm.dk.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tm.dk.service.HistoryService;
import com.tm.entity.CompanyEntity;
import com.tm.entity.dto.CompanyDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("history")
public class HistoryController {
    @Autowired
    private HistoryService historyService;

    @PostMapping("page")
    public Page<CompanyEntity> page(CompanyDto companyDto,
                                    @RequestParam(required = false, defaultValue = "1") Integer page,
                                    @RequestParam(required = false, defaultValue = "5") Integer pageSize
    ) {
        Page<CompanyEntity> companyEntityPage = new Page<CompanyEntity>(page, pageSize);
        return historyService.getpage(companyDto, companyEntityPage);
    }
}